﻿package 
{
	import flash.display.MovieClip;
	import flash.text.TextField;
	import flash.events.Event;
	
	public class LocationText extends MovieClip 
	{	
		private static const FinalFrame:int = 100;
		
		public function LocationText(messageToDisplay:String) 
		{
			nest.messageText.text = messageToDisplay;
			addEventListener(Event.ENTER_FRAME, EnterFrame);
			addEventListener(Event.REMOVED, Unload);
		}
		
		private function Unload(event:Event):void
		{
			if (event.target.name == this.name)
			{
				removeEventListener(Event.ENTER_FRAME, EnterFrame);
			}
		}
		
		private function EnterFrame(event:Event):void
		{
			if (currentFrame == FinalFrame)
			{
				this.parent.removeChild(this);
			}
		}
	}
}